package org.ruanjj.designmodel.enumsingleton;

//懒汉式，按需创建
//基础版，存在线程安全问题
public class Singleton1 {
    private static Singleton1 instance;

    //私有化构造函数，不允许在其他地方被创建
    private Singleton1(){

    }

    public static Singleton1 getSingleton1() {
        if(instance != null){
            instance = new Singleton1();
        }

        return instance;
    }
}
